<!-- pages/songs/index.vue 歌曲列表页 -->
<template>
    <view class="song-list-page">
        <scroll-view class="list-container" scroll-y>
            <view v-for="song in songList" :key="song.id" class="song-item" @click="navigateToDetail(song.id)">
                <view class="item-content">
                    <text class="song-title">{{ song.name }}</text>
                    <text class="song-desc">{{ song.description }}</text>
                </view>
                <uni-icons type="arrowright" size="20" color="#999" />
            </view>
        </scroll-view>
    </view>
</template>

<script setup>
import { ref } from 'vue';
import { useSongStore } from '@/stores/songs';

const songStore = useSongStore();
const songList = computed(() => songStore.songs);

const navigateToDetail = (id) => {
    uni.navigateTo({
        url: `/pages/songs/detail?id=${id}`
    });
};
</script>

<style lang="scss" scoped>
.song-list-page {
    height: 100vh;
    background: #f5f5f5;

    .list-container {
        height: 100%;
        padding: 20rpx;
    }

    .song-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 30rpx;
        margin-bottom: 20rpx;
        background: white;
        border-radius: 12rpx;
        box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);

        .item-content {
            flex: 1;
            margin-right: 20rpx;
            display: flex;
            flex-direction: column;
        }

        .song-title {
            font-size: 32rpx;
            color: #333;
            font-weight: 500;
            margin-bottom: 10rpx;
        }

        .song-desc {
            font-size: 26rpx;
            color: #666;
        }
    }
}
</style>